/******************************************************************************
COPYRIGHT (C) 2013 by IT-Designers GmbH

File:		Timer.h
Created:	21.02.2012
Modified:	11.04.2013
Author:		Max Pejs
******************************************************************************/

#ifndef TIMER_H
#define TIMER_H

#ifdef WIN32
#include <windows.h>
#include <ctime>
#include <string>
#endif

#include "StringIdObject.h"

using namespace std;

class Timer : public StringIdObject
{
private:
	__int64 StartTime;
	double LastRunTimeUs;
	double TotalRunTimeUs;
	double AvgRunTimeUs;
	__int64 MeasCnt;
	double PCFrequency;
	bool Stopped;
	int Weight;
	Timer();

public:
	Timer(string id, int weight = 50);
	~Timer();

	void Start();
	void Stop();
	double GetRunTimeInUs();
	double GetExactAvgRunTimeInUs();
	double GetExactAvgRunTimeInMs();
	double GetWeightAvgRunTimeInMs();

	bool operator == (const Timer &other) const;
};

#endif	//	TIMER_H